import http from '../utils/http'
import store from '../store/index'

const URL = process.env.VUE_APP_BASE_CUSTOMER
// if ('true' !== process.env.VUE_APP_USE_MOCK) {
//   URL = process.env.VUE_APP_BASE_CUSTOMER
// }

export default {
  // 验证用户登录状态
  accountCheck (params = {}) {
    params.type = store.getters.getType
    params.system = store.getters.getSystem
    params.third = store.getters.getThirdToken
    params.token = store.getters.getToken
    return http.get(URL + '/account/check', params)
  },
  // 验证lxb用户登录状态
  accountLxbCheck (params = {}) {
    params.type = store.getters.getType
    params.system = store.getters.getSystem
    params.third = store.getters.getThirdToken
    params.token = store.getters.getLxbToken
    params.lxbToken = true
    return http.get(URL + '/account/check', params)
  },
  //获取第三方信息
  thirdInfo (params) {
    return http.get(URL + '/third/info', params)
  },
  //使用第三方账户进行账户登陆
  thirdLogin (params) {
    return http.get(URL + '/third/login', params)
  },
  //第三方快捷登陆
  thirdAuth (params) {
    return http.get(URL + '/third/auth', params)
  },
  //登陆
  login (params) {
    params.type = store.getters.getType
    params.system = store.getters.getSystem
    return http.get(URL + '/account/login', params)
  },
  //获取用户信息
  accountInfo (params) {
    return http.post(URL + '/account/info', params)
  },
  //发送短信验证码
  smsSend (params) {
    params.type = store.getters.getType
    params.system = store.getters.getSystem
    return http.post(URL + '/verify/sms', {
      data: params,
      contentType: 'form'
    })
  },
  getGraphId() {
    return http.get(URL + '/verify/graph')
  },
  getGraphCode(params) {
    return `${URL + '/verify/showgraph/'+params}`
  },
  //微信授权分享
  chImg (params) {
    // params.type = store.getters.getType
    params.type = 'xkgxwx'
    // params.system = store.getters.getSystem
    params.system = 'xk'
    return http.post(URL + '/common/initParams', {
      // data: params,
      data: {
        ...params
      },
      contentType: 'form'
    })
  },
  getUserList (params) {
    return http.get(URL + '/user/listpage', params)
  },
  // 查询已绑银行卡 ||
  cardsList(params = {}){
    params.lxbToken = true
    return http.post(URL + '/cards/list',params)
  },
  //判断是否有支付密码
  paymentPwd(params = {}){
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/account/info',params)
  },
  // 解绑银行卡，
  cardsUnbound(params = {}){
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/cards/unbound',params)
  },
  // 修改/重置支付密码
  modifyPassword (params = {}) {
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/password/modify',params)
  },
  // 绑卡验证
  cardsBindCheck (params = {data:{}}) {
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/cards/bindCheck',params)
  },
  // 发送短信验证码 
  verifySms (params = {data:{}}) {
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/verify/sms',params)
  },
  // 绑卡
  cardBind (params = {data:{}}) {
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/cards/bind',params)
  },
  // 验证实名信息
  passwordCheck (params = {data:{}}) {
    params.lxbToken = true
    params.contentType = 'form'
    return http.post(URL + '/password/check',params)
  },
  // 影像识别
  ocrEecognize (params = {}) {
    params.contentType = 'form'
    return http.post(URL + '/ocr/recognize',params)
  },
  // 校验短信验证码
  verifyCheck (params) {
    return http.post(URL + '/verify/check', {
      data: params,
      contentType: 'form'
    })
  },
  wxworkSign (params) {
    return http.post(URL + '/third/initParams/qywx', {
      data: params,
      contentType: 'form'
    })
  }
}